import config from './utils/config.js'
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import fs from 'node:fs'
import path from 'node:path'
export default defineConfig({
	plugins: [uni()],
	server: {
		proxy: {
			"/apiH5": {
				target: config.proxy,
				"changeOrigin": true,
				rewrite: (path) => path.replace(/^\/apiH5/, '') ,// 重写 url 的 path 部分
			},
		},
		port: '80',
		// https: {
		// 	cert: fs.readFileSync(path.resolve(__dirname,'utils/https/ssl.crt')),
		// 	key: fs.readFileSync(path.resolve(__dirname,'utils/https/ssl.key')),
		// }
	},
	build: {
		minify: 'terser',
		terserOptions: {
			compress: {
				drop_console: false,
			},
		},
		rollupOptions: {
		}
	},
});